<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.8/dist/css/layui.css" rel="stylesheet">
</head>
<body>
<div class="layui-btn-container">
    <button type="button" class="layui-btn layui-btn-primary" lay-on="alert" onclick="onAlert()">Alert</button>
    <button type="button" class="layui-btn layui-btn-primary" lay-on="confirm" onclick="onConfirm()">Confirm</button>
    <button type="button" class="layui-btn layui-btn-primary" lay-on="msg">Msg</button>
    <button type="button" class="layui-btn layui-btn-primary" lay-on="page">Page</button>
    <button type="button" class="layui-btn layui-btn-primary" lay-on="iframe">Iframe</button>
    <button type="button" class="layui-btn layui-btn-primary" lay-on="load">Load</button>
    <button type="button" class="layui-btn layui-btn-primary" lay-on="tips">Tips</button>
    <button type="button" class="layui-btn layui-btn-primary" lay-on="prompt">Prompt</button>
    <button type="button" class="layui-btn layui-btn-primary" lay-on="photots">Photots</button>
</div>
<script src="//unpkg.com/layui@2.9.8/dist/layui"></script>
<script>
    function onAlert() {
        layer.alert('这是一个警告1');
    }

    function onConfirm(){
        layer.confirm(
            '一个confirm框1',
            {btm:['确认','关闭']},
            function (){
                layer.msg('点击确认',{icon: 1});
            },
            function (){
                layer.msg('点击取消',{time:2000,btm:['明白了','知道了']})
            }

        )
    }
</script>
</body>
</html>